<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>锤子科技官方商城</title>

<link rel="stylesheet" type="text/css" href="CSS/CSSshoppingmall.css" />

<script src="js/jquery.js"></script>
 <script src="//apps.bdimg.com/libs/jquery/1.10.2/jquery.min.js"></script>
  <script src="//apps.bdimg.com/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
<script>
  $(document).ready(function() {
    

   //产品展示框内阴影鼠标效果

	   //form和jiage鼠标效果
	   
	   
	   $('#listproducts td').hover(
	       function(){
			   $(this).addClass("tdboxshadow");
			$(this).children(".productprice").addClass("hide");
			$(this).children("form").removeClass("hide");
			},
			function(){
				$(this).removeClass("tdboxshadow");
			$(this).children(".productprice").removeClass("hide");
			$(this).children("form").addClass("hide");
			}
	   );
	 
	 //商品图片自动播放
	var num = $('.span_dot span').length;
	var i_num = 0;
	var timer_banner = null;
	
	
	
	
	//点击span小图标切换效果
	$('.span_dot span').mouseover(
	    function(){
			//切换小图标
			$(this).addClass('onshowspan').siblings('span').removeClass('onshowspan');
			//切换图片
			var i_num1 = $('.span_dot span').index(this);
			$('.imgtd li').eq(i_num1).fadeIn('slow').siblings('li').fadeOut('slow');
			i_num = i_num1;
			}
	);


	
//加入购物车	
	//获取userid
	var num4, dlk;
		  dlk =document.getElementById('dlk').innerHTML; 
 
		  if( dlk.indexOf('user/login.php') < 0){
		var num4 = document.getElementById('userid').innerHTML;
		    num4 = num4.slice(7, -8);
		  }
		  else{ num4 = '';}
    
	
	 //商品名和userid存入数据库且不跳转
     $('p').click(function(){
	   var  num10=$(this).attr('name');
		// alert(num10); 
		 
		  if(num4 == ''){
			  
			  window.location.href="user/login.php";

			  }
		  else{
		// alert(num4);
		  $.post(
		      "addtobuy.php",
			  { "proid": num10,
				"userid": num4,
				  }
			//, function(data,status){ alert("数据: \n" + data + "\n状态: " + status);}
                );
				
		     }
		  });
	
	 //加入购物车动画
	   $('.gocar').on('click', function () {
        var cart = $('#img2');
        var imgtodrag = $(this).parent().find("img");
        if (imgtodrag) {
            var imgclone = imgtodrag.clone()
                .offset(
				$(this).offset()
				)
                .css({
                'opacity': '0.5',
				'display': 'block',
                    'position': 'absolute',
                    'height': '50px',
                    'width': '50px',
                    'z-index': '100'
            })
                .appendTo($('body'))
                .animate({
                   'top': cart.offset().top + 10,
                    'left': cart.offset().left + 10,
                    'width': 25,
                    'height': 25
            }, 1000, 'easeInOutExpo');
            
            imgclone.animate({
                'width': 0,
                    'height': 0
            }, function () {
                $(this).detach()
            });
        }
    });
	
    
 
});
</script>

</head>

<body>

<?php
include "head.php";



?>
   
<div id="tbody" style="width: 1100px; height: auto; margin: 0 auto; border: 0px solid #000">
    <div id="menu">
        <div id="menu1"> 
            <ul>
                
          <?php
		        //循环输出menu1，并赋id给其超链接
		    $query1 = "select * from product_class order by show_order";
			$result1 = $aa->excu($query1);
			while ($product_class = mysqli_fetch_array($result1, MYSQLI_ASSOC))	{	

		?>
                
                
                <li><a href="?action=creat&id=<?php echo $product_class['id']; ?>">
				<?php echo $product_class['class_name']; ?></a>

                </li>
          <?php
			      }
	   	?>
            </ul>
        </div>
        
        

    </div>
    
    <div>
   <?php
    include "creatlist.php";
   ?>
   
 
    
    </div>
    
      
    
    <div id="aftersale">
        <table>
            <tr>
                <td><a href=""><img src="img/service.png" alt="" /></a></td><td><img src="img/days7.png" alt="" /></td><td><img src="img/days15.png" alt="" /></td><td><img src="img/freeshipping.png" alt="" /></td>
            </tr>
            <tr>
                <td><a href=""><strong>在线客服</strong></a></td><td><strong>7天无理由退货</strong></td><td><strong>15天免费换货</strong></td><td><strong>满150元免运费</strong></td>
            </tr>
            <tr>
                <td><a href=""><small>周一至周日&nbsp;9:00-18:00</small></a></td><td><small>天无理由退货&nbsp;请放心购买</small></td><td><small>15天内如遇质量问题&nbsp;免费换货</small></td><td><small>全场使用顺丰快递</small></td>
            </tr>
        </table>
    </div>

</div>
<?php
include "foot.php";
?>


</body>
</html>